﻿using System;

namespace TeamCommunitySolution.Domain.DataLayer.Base
{
    [Serializable]
    public class MessageOutbox
    {
        /// <summary>
        /// Gets or sets the id.
        /// </summary>
        /// <value>The id of the instance.</value>
        public virtual string Id { get; set; }

        /// <summary>
        /// Gets or sets the title.
        /// </summary>
        /// <value>The title.</value>
        public virtual string Title { get; set; }

        /// <summary>
        /// Gets or sets the content of the message.
        /// </summary>
        /// <value>The content of the message.</value>
        public virtual string MessageContent { get; set; }

        /// <summary>
        /// Gets or sets the date sent.
        /// </summary>
        /// <value>The date sent.</value>
        public virtual DateTime DateSent { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is read.
        /// </summary>
        /// <value><c>true</c> if this instance is read; otherwise, <c>false</c>.</value>
        public virtual bool IsRead { get; set; }

        /// <summary>
        /// Gets or sets the user to.
        /// </summary>
        /// <value>The user to.</value>
        public virtual SystemUser UserTo { get; set; }

        /// <summary>
        /// Gets or sets the user from.
        /// </summary>
        /// <value>The user from.</value>
        public virtual SystemUser UserFrom { get; set; }

        /// <summary>
        /// Gets the short description.
        /// </summary>
        /// <value>The short description.</value>
        public virtual string ShortDescription
        {
            get
            {
                if (this.MessageContent.Length > 50)
                {
                    return this.MessageContent.Substring(0, 50);
                }

                return this.MessageContent;
            }
        }
    }
}
